package ${implPackage};

import org.springframework.stereotype.Service
import ${servicePackage}.${serviceName}
import ${mapperPackage}.${mapperName};
import ${entityPackage}.${entityName}

/**
* ${tableComment}(table: ${tableName}) 接口实现
* @author ${author}
* @since ${date}
*/
@Service
open class ${implName}(
    private val ${mapperName?uncap_first}: ${mapperName}
) : ${serviceName}{

    /**
     * 插入新数据
     * @author ${author}
     * @since ${date}
     * @param entity:
     * @return com.test.entity.UserEntity
    */
    override fun insert(entity: ${entityName}): ${entityName}{
        ${mapperName?uncap_first}.insert(entity)
        return entity
    }

<#if primaryColumn?? && (primaryColumn?size == 1)>
    /**
     * 根据ID删除记录
     * @author ${author}
     * @since ${date}
     * @param id:
    */
    override fun deleteById(id: Any){
        ${mapperName?uncap_first}.deleteById(id)
    }

    /**
     * 根据ID更新记录
     * @author ${author}
     * @since ${date}
     * @param param:
    */
    override fun updateById(param: ${entityName}){
    ${mapperName?uncap_first}.updateById(param)
    }

    /**
     * 根据ID选择性更新
     * @author ${author}
     * @since ${date}
     * @param param:
    */
    override fun updateSelectiveById(param: ${entityName}){
        ${mapperName?uncap_first}.updateSelectiveById(param)
    }

    /**
     * 根据ID查询记录
     * @author ${author}
     * @since ${date}
     * @param id:
     * @return ${entityPackage}.${entityName}
    */
    override fun selectById(id: Any): ${entityName}?{
        return ${mapperName?uncap_first}.selectById(id)
    }

</#if>
}

